﻿namespace IBTrader.Modules.Configuration
{
    using System;

    class Times
    {
        public const string DateTimeFormat = "yyyy-MM-ddTHH:mm:ss";
        public const string DateFormat = "yyyy-MM-dd";
        #region Adjustment
        //private static DateTime utc = DateTime.UtcNow;
        //private static TimeSpan usToUTC = // this is a positive value
        //    utc - TimeZoneInfo.ConvertTimeBySystemTimeZoneId(utc, "Eastern Standard Time");
        ////internal static DateTime USToUtc(DateTime dt) { return (dt + usToUTC); }
        //internal static DateTime UtcToUs(DateTime dt) { return (dt - usToUTC); }
        //internal static DateTime US { get { return (DateTime.UtcNow - usToUTC); } }
        internal static DateTime UtcToNow(DateTime utc) { return TimeZone.CurrentTimeZone.ToLocalTime(utc); }
        internal static DateTime Now { get { return DateTime.Now; } }
        internal static bool InRange(TimeSpan from, TimeSpan to, TimeSpan ts) 
        {
            return from < to && ts > from && ts < to || from > to && (ts > from || ts < to); // workdays or overnight
        }
        #endregion
    }
}
